<?php
	$protectid="6"; 
	include("../protect.php");
	
	include_once("../../config.inc.php");
	
	include_once(CFG_LIB_DIR.'mysqldb.inc.php');
	$objDb = new mysqldb();
	
//		include_once(CFG_LIB_DIR.'mysqldb.inc.php');
	$db = new mysqldb();
	
	include_once(CFG_LIB_DIR."block.php");
	$Block = new clsBlock();
	
	include_once(CFG_LIB_DIR."generic.lib.php");
	$objBase = new clsBase();
	
	$intMemID = $_SESSION['M_Id'];
	
	include_once(CFG_LIB_DIR."manage_page.php");	
	$objManPage = new clsManagePage();
	
	if($state == 1) $con  = " and  g.state in (1,2) ";
	else $con  = " and  g.state = 0 ";
	
	if($number!=""){$con .=" and g.number like '%$number%' ";}
	if($guest_name)  {$con .=" and g.guest_name  like '%$guest_name%' ";}
	if($s_county)  {$con .=" and g.s_county like '%$s_county%' ";}
	if($s_qu)  {$con .=" and g.s_qu = '$s_qu' ";}
	
	//分页获取数据
	$FeedbackResult = $objManPage->GetResult('g.*,m.s_county,m.s_qu', '`'.con_strPREFIX.'guestbook` as g right join hy_member as m on m.user_id = g.memberID 
	
	', $con."  ORDER BY g.`guest_id` DESC", 12, true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator's Control Panel</title>

<?php include_once("../common/files.php"); ?>
</head>
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<body id="main" >

<form name="form1" method="post" action="">
<table>
                            <tr>
                            
                              <td width="53%" height="24" nowrap><span class="style1">号码:</span>&nbsp;&nbsp;
                                  <input name="number" type="text"  size="20">
                                  <span class="style1">预约人:</span>&nbsp;&nbsp;
                                  <input name="guest_name" type="text"  size="20">
                                  
                                  <span class="style1">市 区（县） 镇 :</span>&nbsp;&nbsp;
                                  <select name="s_city" id="s_city">
       <option value=''>
	       请选择
	      </option>
	    <?php	
		$SQL=" select * from hy_b_city where ParentID =116  ";
		$db->query($SQL);
		$result = $db->get_data();
		if($result){
		foreach($result as $key=>$value){
	 ?>
	    <option value="<?=$value['CityID']?>">
	      <?=$value['CateName']?>
	      </option>
	    <? }}?>
      </select>
      
	   <select name="s_county" id="s_county">
	    <option value=''>
	       请选择
	      </option>
      </select>
          
           <select name="s_qu" id="s_qu">
	    <option value=''>
	       请选择
	      </option>
      </select>     
                   
                   
                    <script>
          
$('#s_city').change( function () { 
		$.ajax({
		   type: "get",
		   url: "../../selectcity.php",
		   data: "pid="+this.value,
		   success: function(msg){
			  // alert(msg);
			    $('#s_county').html(msg);
		   }
		});
});


$('#s_county').change( function () { 
		$.ajax({
		   type: "get",
		   url: "../../selectcity.php",
		   data: "pid="+this.value,
		   success: function(msg){
			    $('#s_qu').html(msg);
//			 alert( "Data Saved: " + msg );
		   }
		});
});



          </script>              </td>
                                  
                                  
                              <td width="13%"><input type="submit" name="Submit2" value="搜索"></td>
                            </tr></table>
                          </form>
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
  <tr>
    <td><h1>查看3G订单</h1></td>
  </tr>
</table>


<form method="post" action="qy_feedback_save.php?act=manage" onsubmit="return validForm('Item', 'SelectedID');">
  <table cellspacing="0" cellpadding="0" width="100%"  class="listtable">
    <tr style="font-weight:bold">
     <td></td>
      <td height="30"><div align="center">序号</div></td>
    	<td height="30"><div align="center">号码</div></td>
      <td ><div align="center">选号费</div></td>
      <td ><div align="center">套餐计划</div></td>
      <td ><div align="center">套餐名称</div></td>
      <td ><div align="center">首月套餐方式</div></td>
      <td ><div align="center">客户名称</div></td>
      <td ><div align="center">预约人</div></td>
      <td ><div align="center">县分</div></td>
      <td ><div align="center">区域</div></td>
      <td ><div align="center">证件号码</div></td>
      <td ><div align="center">订单状态</div></td>
      <td ><div align="center">预约时间</div></td>
      <td>操作</td>
    </tr>
    <?php
	//输出 Manage Grid
	if(is_array($FeedbackResult))
	{
		foreach($FeedbackResult as $key => $record)
		{
?>
   
    <tr>
    <td> <input type="checkbox" name="Item" id="Item<?php echo $key; ?>" value="<?php echo $record['guest_id']; ?>"/></td>
      <td><?php echo trim($record['guest_id']);?></td>
      <td><?php echo trim($record['number']);?></td>
      <td><?php echo trim($record['choosingcost']);?></td>
      <td><?php echo trim($record['numbertype']);?></td>
      <td><?php echo trim($record['packagetype']);?></td>
      <td><?php echo trim($record['selectpackages']);?></td>
      <td><?php echo trim($record['guest_name']);?></td>
      <td><?php echo trim($record['guest_name']);?></td>
      <td>
      <?php	
	 	$SQL3=" select CateName from hy_b_city where CityID = '".$record['s_county']."'";
		$db->query($SQL3);
		$result2 = $db->get_data();
		echo $result2[0]['CateName'];
	 ?>
      </td>
      <td>
      <?php	
	    $SQL2=" select CateName from hy_b_city where CityID = '".$record['s_qu']."'";
		$db->query($SQL2);
		$result2 = $db->get_data();
		echo $result2[0]['CateName'];
	   
	 ?>
      </td>
      <td><?php echo trim($record['ID']);?></td>
      <td> <?
        if($record['state'] == 1) echo "成功开户";
		    elseif($record['state'] == 2) echo "作废订单";
				else echo "未处理";
		?></td>
      <td><?php echo date("Y-m-d H:i:s",$record['guest_date']);?></td>
      <td>
      
      <label for="Item<?php echo $key; ?>">删除</label>
      
      <? if($state == 0){ ?>
      <a href="view.php?id=<?=$record['guest_id']?>" >处理订单</a>
      <? }?>
      <a href="view.php?id=<?=$record['guest_id']?>" target="_blank">查看详细？</a>
      </td>
      
    </tr>
   <?
   	}
	}
	
   ?>
  </table>
  <?php	
	
	//输出批量操作
	include_once(CFG_LIB_DIR.'batch_operation.php');
	$objBO = new clsBatchOperation();
	
	$arrOperation = array ("RevChk", "Del");
	$arrBO = $objBO->strBottom($arrOperation, "Del");
	
	echo $arrBO[0].$arrBO[1];
	
	//输出分页
	echo $objManPage->ShowLink();
?>
  <div align="center" style="padding: 5px;">
    <input type="hidden" name="SelectedID" id="SelectedID" />
    <input type="submit" value="提交保存" class="submit" />
    <input type="reset" value="重置" class="submit" />
  </div>
</form>
<?php include "../bottom.php"; ?>
</body>
</html>
